home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Http Server / •HTTP Server / HTTPServer.cp next >
Encoding:
Text File  |  1996-01-11  |  1.6 KB  |  58 lines  |  [TEXT/CWIE]

  1. //    ServerShell.cp - Macintosh OpenTransport Network Server shell 
  2. //
  3. // Apple Macintosh Developer Technical Support
  4. // Written by:  Vinne Moscaritolo
  5. //
  6. //  Copyright (work in progress)  Apple Computer, Inc All rights reserved.
  7. //
  8. // You may incorporate this sample code into your applications without
  9. // restriction, though the sample code has been provided "AS IS" and the
  10. // responsibility for its operation is 100% yours.  However, what you are
  11. // not permitted to do is to redistribute the source as "DSC Sample Code"
  12. // after having made changes. If you're going to re-distribute the source,
  13. // we require that you make it clear in the source that the code was
  14. // descended from Apple Sample Code, but that you've made changes.
  15. //
  16.         
  17. #include "THTTPServer.h"
  18.  
  19. // ---------------------------------------------------------------------------
  20. //     main
  21. // ---------------------------------------------------------------------------
  22. //    xxx
  23.  
  24. #include <strstream.h>
  25.  
  26.  
  27. void main()
  28. {
  29. char errorBuf[256];
  30. ostrstream err( errorBuf,256);
  31.  
  32.     try
  33.     {
  34.         THTTPServerApp      theApp; 
  35.         theApp.Start();
  36.     }
  37.  
  38. // Error handler
  39.     catch (TNetworkException &ex)
  40.     {
  41.         err << "NETWORK EXCEPTION: " << ex.GetExceptionMessage() << ", OSStatus: " << ex.GetOSStatus() <<
  42.                 ", File: " << ex.GetExceptionFile() << ", Line: " << ex.GetExceptionLine() << endl;
  43.     }
  44.     
  45.     catch(TMacException &ex)
  46.     {
  47.         err << "EXCEPTION: " << ex.GetExceptionMessage() << ",  OSErr: " << ex.GetExceptionOSErr() <<
  48.                 ", File: " << ex.GetExceptionFile() << ", Line: " << ex.GetExceptionLine() << endl;
  49.     }
  50.     
  51.     catch(...)        // catch everything
  52.     {
  53.         err <<"Undefined exception.\n";
  54.     } 
  55.  
  56.  
  57. }
  58.